<style>

    table a{
        border-radius: 2px;
        color: #09c;
        display: block;
        float: left;
        font-size: 20px;
        font-weight: bold;
        margin: 5px;
        padding: 1px 6px;

    }
    table a:hover{

        color: #fff;
        background: #09c;
        box-shadow: 0 0 3px #09c;

    }
    table a.dis{

        color: #ccc;


    }
    table a.dis:hover{

        color: #09c;
        background: #fff;
        box-shadow: 0 0 3px #09c;

    }
    .status-bar{

        font-size: 16px;
        font-weight: bold;

    }
    .status-bar a{

        margin: 0 5px;

    }
</style>
<div class="col-xs-12 col-md-12 col-lg-12 status-bar">

    首字母:
    <a href="javascript:;" data-data='A'>A</a>
    <a href="javascript:;" data-data='B'>B</a>
    <a href="javascript:;" data-data='C'>C</a>
    <a href="javascript:;" data-data='D'>D</a>
    <a href="javascript:;" data-data='E'>E</a>
    <a href="javascript:;" data-data='F'>F</a>
    <a href="javascript:;" data-data='G'>G</a>
    <a href="javascript:;" data-data='H'>H</a>
    <a href="javascript:;" data-data='I'>I</a>
    <a href="javascript:;" data-data='J'>J</a>
    <a href="javascript:;" data-data='K'>K</a>
    <a href="javascript:;" data-data='L'>L</a>
    <a href="javascript:;" data-data='M'>M</a>
    <a href="javascript:;" data-data='N'>N</a>
    <a href="javascript:;" data-data='O'>O</a>
    <a href="javascript:;" data-data='P'>P</a>
    <a href="javascript:;" data-data='O'>Q</a>
    <a href="javascript:;" data-data='R'>R</a>
    <a href="javascript:;" data-data='S'>S</a>
    <a href="javascript:;" data-data='T'>T</a>
    <a href="javascript:;" data-data='U'>U</a>
    <a href="javascript:;" data-data='V'>V</a>
    <a href="javascript:;" data-data='W'>W</a>
    <a href="javascript:;" data-data='X'>X</a>
    <a href="javascript:;" data-data='Y'>Y</a>
    <a href="javascript:;" data-data='Z'>Z</a>
    <a href="javascript:;" data-data='all'>全部</a>

</div>
<table class="table table-hover">
    <tr>
        <th style="border:none;">快递公司</th>
        <th style="border:none;">首字母</th>
        <th style="border:none;">拼音</th>
        <th style="border:none;">网址(仅供参考)</th>
        <th style="border:none;">常用</th>
        <th style="border:none;">状态</th>
        <th style="border:none;">支持服务站配送</th>
    </tr>
    <?php foreach($data as $v):?>
    <tr>
        <td><?php echo $v['name']?></td>
        <td><?php echo $v['letter']?></td>
        <td><?php echo $v['name_en']?></td>
        <td><?php echo $v['url']?></td>
        <td>
            <?php if($v['order_by'] == 1):?>
                <a class="_ajaxNote" data-id="order" data-src="<?php echo U('/Admin/Logistics/Express/update')?>" href="javascript:;" data-data={"where":{"id":<?php echo $v['id']?>},"data":{"order_by":2}}>
                    <i class="fa fa-check"></i>
                </a>
            <?php else:?>
                <a class="_ajaxNote dis" data-id="order" data-src="<?php echo U('/Admin/Logistics/Express/update')?>" href="javascript:;" data-data={"where":{"id":<?php echo $v['id']?>},"data":{"order_by":1}}>
                    <i class="fa fa-check"></i>
                </a>
            <?php endif;?>
        </td>
        <td>
            <?php if($v['state'] == 2):?>
                <a class="_ajaxNote" data-id="state" data-src="<?php echo U('/Admin/Logistics/Express/update')?>" href="javascript:;" data-data={"where":{"id":<?php echo $v['id']?>},"data":{"state":1}}>
                    <i class="fa fa-check"></i>
                </a>
            <?php else:?>
                <a class="_ajaxNote dis" data-id="state" data-src="<?php echo U('/Admin/Logistics/Express/update')?>" href="javascript:;" data-data={"where":{"id":<?php echo $v['id']?>},"data":{"state":2}}>
            <i class="fa fa-check"></i>
                </a>
            <?php endif;?>
        </td>
        <td>
            <?php if($v['zt_state']):?>
                <a class="_ajaxNote" data-id="zt_state" data-src="<?php echo U('/Admin/Logistics/Express/update')?>" data-data={"where":{"id":<?php echo $v['id']?>},"data":{"zt_state":0}} href="javascript:;">
                    <i class="fa fa-check"></i>
                </a>
            <?php else:?>
                <a class="_ajaxNote dis" data-id="zt_state" data-src="<?php echo U('/Admin/Logistics/Express/update')?>" data-data={"where":{"id":<?php echo $v['id']?>},"data":{"zt_state":1}} href="javascript:;">
                    <i class="fa fa-check"></i>
                </a>
            <?php endif;?>
        </td>
    </tr>
    <?php endforeach;?>
</table>
<script>
//    //异步提交回掉

    $(function(){

        $('.status-bar a').click(function(){

            var data = {};
            data.letter  = $(this).data('data');

            if(data.letter == 'all')
                delete data.letter

            layer.load();

            $('#main-content').load("<?php echo U('/Admin/Logistics/Express/lists');?>",{'data':data},function(){

                layer.closeAll();

            })


        })

    })
function ajaxRequestCallback(result,id,_this){
    if(!result)
        return false;

    switch (id){

        case 'order':

            if(result.code == 200){

                if(result.data.data.order_by == 1) {

                    result.data.data.order_by = 2;

                    //_this
                    _this.removeClass('dis');

                }else if(result.data.data.order_by == 2){
                    _this.addClass('dis');


                    result.data.data.order_by = 1;
                }

                _this.data('data',result.data);
            }

            break;

        case 'state':


            if(result.code == 200){

                if(result.data.data.state == 1) {

                    result.data.data.state = 2;

                    //_this
                    _this.addClass('dis');

                }else if(result.data.data.state == 2){
                    _this.removeClass('dis');

                    result.data.data.state = 1;
                }

                _this.data('data',result.data);
            }

            break;

        case 'zt_state':



            if(result.code == 200){

                if(result.data.data.zt_state == 1) {

                    result.data.data.zt_state = 0;

                    //_this
                    _this.removeClass('dis');

                }else if(result.data.data.zt_state == 0){
                    _this.addClass('dis');


                    result.data.data.zt_state = 1;
                }

                _this.data('data',result.data);
            }
            break;

    }

    showMessage(result.msg,result.code,'','',1000);

}
</script>